import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
import { HerosComponent } from './heros/heros.component';
import { ItemDetailComponent } from './item-detail/item-detail.component';
import { provideAuth0 } from '@auth0/auth0-angular';
import { RouterLink, RouterLinkActive, RouterLinkWithHref, RouterOutlet, Routes, provideRouter } from '@angular/router';
import { CallbackComponent } from './callback/callback.component';
import { loginGuard } from './auth/auth.guard';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { MatTreeModule } from '@angular/material/tree';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { ScrollTableComponent } from './data-table/scroll-table.component';

export const routes: Routes = [
  {path: 'heros', component: HerosComponent, canActivate: [loginGuard] },
  {path: 'details', component: ItemDetailComponent },
  {path: 'scroll-table', component: ScrollTableComponent },
  {path: 'callback', component: CallbackComponent },
]

@NgModule({
  declarations: [
    AppComponent,
    ItemDetailComponent,
    CallbackComponent
  ],
  imports: [
    BrowserModule,
    RouterOutlet,
    RouterLink,
    RouterLinkActive,
    HerosComponent,
    MatTreeModule,
    MatIconModule,
    MatButtonModule,
    ScrollTableComponent
  ],
  providers: [
    provideRouter(routes),
    provideAuth0({
      domain: 'dev-ga030mx1.us.auth0.com',
      clientId: '7Ca0U7sn1gNBuERiJVAPmAzI9hfJFtJu',
      authorizationParams: {
        redirect_uri: window.location.origin+'/callback'
      }
    }),
    provideAnimationsAsync(),
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
